/*
 * @Copyright: (C) 2019 Zhang Rida. All rights reserved.
 *
 * @Author: Zhang Rida
 * @Email: 215154317@qq.com
 * @FilePath: /WEILA_SDK_MODULE/src/wlsdk/src/login_module.h
 * @Date: 2021-02-27 17:08:35
 * @Description:
 *
 * @LastEditors: Zhang Rida
 * @LastEditTime: 2022-08-17 16:42:58
 */
#ifndef _LOGIN_MODULE_H
#define _LOGIN_MODULE_H

#include "wl_osal.h"
#include "wlsdk_define.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
    LOGIN_MSG_SET_APPKEY = 0,
    LOGIN_MSG_SET_HARDWARE,
    LOGIN_MSG_SET_ACCOUNT,
    LOGIN_MSG_SET_LOGIN_URL,
    LOGIN_MSG_SET_WEB_SERVER,
    LOGIN_MSG_GET_SERVER_STATE,
    LOGIN_MSG_GET_LOGIN_STATE,
    LOGIN_MSG_GET_EXTENSION_STATE,
    LOGIN_MSG_GET_SELFINFO,
    LOGIN_MSG_GET_USER_CONFIG,
    LOGIN_MSG_LOGIN,
    LOGIN_MSG_LOGOUT,
    LOGIN_MSG_REFRESH_ACCESS_TOKEN,
    LOGIN_MSG_ANSWER_BIND_EXTENSION,

    LOGIN_MSG_OPEN_PROTOCOL_CLIENT,
    LOGIN_MSG_CLOSE_PROTOCOL_CLIENT,
} login_module_msgid;

typedef struct __login_appkey {
    wl_char appid[MAX_APPID_LEN];
    wl_char appkey[MAX_APPKEY_LEN];
} login_appkey;

typedef struct __login_hardware {
    wl_char   id[MAX_ID_LEN];
    wl_char   product[MAX_NAME_LEN];
    wl_char   imei[MAX_IMEI_LEN];
    wl_char   imsi[MAX_IMSI_LEN];
    wl_char   version[MAX_VERSION_LEN];
    wl_uint32 version_number;
    wl_char   firmware[MAX_NAME_LEN];
    wl_uint32 source_type;
} login_hardware;

typedef struct __login_account {
    wl_char account[MAX_ACCOUNT_LEN];
    wl_char country_code[MAX_COUNTRYCODE_LEN];
    wl_char password[MAX_PASSWORD_LEN];
    wl_bool ismd5pwd;
} login_account;

typedef struct __login_url {
    wl_char url[MAX_URL_LEN];
} login_url;

typedef struct __login_server {
    wl_char   host[MAX_HOST_LEN];
    wl_uint16 port;
    wl_char   method[MAX_URL_LEN];
} login_server;

wl_int32 login_module_init(wlsdk_message_callback callback);
wl_int32 login_module_end(void);

#ifdef __cplusplus
}
#endif
#endif
